package com.luoyx.hauyne.audit.mq.consumer;

import com.luoyx.hauyne.admin.api.sys.request.UserProfileUpdatedMsg;
import com.luoyx.hauyne.audit.mapper.UserProfileMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class UserProfileUpdatedConsumer {

    private final UserProfileMapper userProfileMapper;

    @RabbitListener(queues = "USER_PROFILE_UPDATED_QUEUE")
    public void msgSend(UserProfileUpdatedMsg userProfileUpdatedMsg) {
        System.out.println("消费者收到消息：" + userProfileUpdatedMsg);
        userProfileMapper.updateFullName(userProfileUpdatedMsg);
    }
}
